<?php
namespace Admin\Model;
use Think\Model;

class VisitModel extends Model {

    /**
     * 根据制定日期，获取当天的网站访问数
     *
     * @param $y 年
     * @param $m 月
     * @param $d 日
     */
    public function get_visit_by_date($y,$m,$d) {

        $map['y'] = $y;
        $map['m'] = $m;
        $map['d'] = $d;

        $result = $this->where($map)->select();
        if (empty($result)) return 0;
        $viewCount = 0;
        foreach ($result as $v) {
            $viewCount += $v['view'];
        }
        return $viewCount;
    }

}
